<!-- 公共文件 start -->
@extends('admin.public.base')
<!-- 公共文件 end -->

@section('content')
    <div class="layui-fluid">
        <div class="layui-row">
            <form class="layui-form">
                <div class="layui-form-item" style="text-align:center;font-size:18px;">
                    <b>出库订单号：{{$data['order_sn']}}</b>
                    <a href="/admin/stock/orderPdf?id={{$data['id']}}">
                        <div class="icon iconfont" style="float:right;">&#xe6c9;</div>
                    </a>
                </div>
                <hr>
                <div class="layui-card-body layui-table-body layui-table-main">
                    <table class="layui-table layui-form">
                        <thead>
                        <tr>
                            <th>商品名</th>
                            <th>商品分类</th>
                            <th>商品编号</th>
                            <th>单件价格</th>
                            <th>出库数量</th>
                            <th>实付价格</th>
                        </tr>
                        </thead>
                        <tbody>
                        @foreach( $data['goods_list'] as $kk => $item)
                            <tr>
                                <td>{{ $item['goods_name'] }}</td>
                                <td>{{ $item['cate_name'] }}</td>
                                <td>{{ $item['goods_sn'] }}</td>
                                <td>{{ $item['goods_price'] }}</td>
                                <td>{{ $item['goods_number'] }}</td>
                                <td>{{ $item['goods_amount'] }}</td>
                            </tr>
                        @endforeach
                        </tbody>
                    </table>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label"><b>总计：</b></label>
                    <div class="layui-input-block" style="line-height:36px">
                        数量：{{$data['total_number']}}个， 运费：{{$data['freight']}}元， 金额：{{$data['goods_pay_amount']}}元，
                        总金额：{{$data['order_amount']}}元 <br>
                    </div>
                </div>
                <hr>

                <div class="layui-form-item">
                    <label class="layui-form-label"><b>代理商信息：</b></label>
                    <div class="layui-input-block" style="line-height:36px">
                        {{$storeInfo['store_name']}}<br>
                        货款余额：{{$storeInfo['money_goods']}}元<br>
                        管理费余额：{{$storeInfo['money_management']}}元 <br>
                        联系人：{{$storeInfo['principal_name']}}，手机号：{{$storeInfo['principal_mobile']}}
                        ，地址：{{$storeInfo['principal_address']}}
                    </div>
                </div>
                <hr>
                <div class="layui-form-item">
                    <label class="layui-form-label"><b>收货信息：</b></label>
                    <div class="layui-input-block" style="line-height:36px">
                        收货人：{{$data['order_name']}}<br/>
                        手机号：{{$data['order_mobile']}}<br/>
                        地址：{{ $data['order_province'] }}，{{ $data['order_city'] }}，{{ $data['order_area'] }}
                        ，{{$data['order_address']}}<br/>
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label"><b>出库商品批次：</b></label>
                    <div class="layui-input-block" style="line-height:36px">
                        批次号：{{$data['store_product_batch']}}<br/>
                    </div>
                </div>
                <div class="layui-form-item">
                    <div class="layui-block">
                        <label class="layui-form-label">备注</label>
                        <div class="layui-input-block">
                            <textarea placeholder="请输入内容" class="layui-textarea" name="remark" >{{ $data['remark'] }}</textarea>
                        </div>
                    </div>
                </div>
                <hr>
                <div class="layui-form-item">
                    <label class="layui-form-label"><b>订单状态：</b></label>
                    <div class="layui-input-block" style="line-height:36px">
                        出库状态：<b style="color:{{$data['order_status_color']}}">{{$data['status_name']}}</b><br>
                        操作人：{{$data['update_user']}}
                    </div>
                </div>
            </form>
        </div>
    </div>
    <script type="text/javascript" src="/static/admin/js/xcity.js"></script>
    <script>
        layui.use(['form', 'layer', 'jquery', 'code'], function () {
            $ = layui.jquery;
            var form = layui.form,
                layer = layui.layer;
            //监听提交
            form.on('submit(add)', function (data) {
                if (confirm("你确定通过-转出库单吗？")) {
                    //发异步，把数据提交给php
                    $.ajax({
                        type: 'POST',
                        url: '/admin/order/orderEdit',
                        data: data.field,
                        dataType: 'json',
                        headers: {
                            'X-CSRF-TOKEN': $('meta[name="_token"]').attr('content')
                        },
                        success: function (data) {
                            layer.alert(data.msg)
                            if (data.code == 1) {
                                //关闭当前frame
                                xadmin.close();
                                // 可以对父窗口进行刷新
                                xadmin.father_reload();
                            }
                        },
                        error: function (xhr, type) {
                            alert('Ajax error!')
                        }
                    });
                }
                return false;
            });
            //监听提交
            form.on('submit(cancel)', function (data) {
                //发异步，把数据提交给php
                if (confirm("你确定审核不通过吗？")) {
                    $.ajax({
                        type: 'POST',
                        url: '/admin/order/orderEdit?cancel=1',
                        data: data.field,
                        dataType: 'json',
                        headers: {
                            'X-CSRF-TOKEN': $('meta[name="_token"]').attr('content')
                        },
                        success: function (data) {
                            layer.alert(data.msg)
                            if (data.code == 1) {
                                //关闭当前frame
                                xadmin.close();
                                // 可以对父窗口进行刷新
                                xadmin.father_reload();
                            }
                        },
                        error: function (xhr, type) {
                            alert('Ajax error!')
                        }
                    });
                }
                return false;
            });

        });
    </script>
@endsection
